package cn.lastcc.toolsCollection.test;

import java.awt.Button;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.Toolkit;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import cn.lastcc.toolsCollection.common.WindowCloseing;
import cn.lastcc.toolsCollection.vessel.DialogButtonType;
import cn.lastcc.toolsCollection.vessel.DialogIconType;
import cn.lastcc.toolsCollection.vessel.MessageDialog;

/**
 * 对话框测试窗体<br>
 * <b>请勿删除 <br>
 * Don't Delete this file!!</b>
 * @author baidongyang
 *
 */
public class DialogTestFrame {

    public static void main(String[] args) {
        MainFrame _mf = new MainFrame("测试窗口");
        _mf.setVisible(true);
    }

}

class MainFrame extends Frame {

    private static final long serialVersionUID = -1879220742759063610L;

    Button btnShowMessage;

    public MainFrame(String title) {
        super(title);
        // 设置窗体居中
        int screenWidth = Toolkit.getDefaultToolkit().getScreenSize().width;
        int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height;
        this.setBounds(screenWidth / 2 - 400, screenHeight / 2 - 325, 800, 650);
        this.addWindowListener(new WindowCloseing(this, true));
        this.setLayout(new FlowLayout());

        btnShowMessage = new Button("弹一个");
        this.btnShowMessage.addMouseListener(new BtnShowMessage_onClick());
		this.add(btnShowMessage);
    }

    class BtnShowMessage_onClick extends MouseAdapter {

		@Override
		public void mouseClicked(MouseEvent e) {
//			boolean _is = MessageDialog.show("内容", "标题", DialogButton.OK);
//	        System.out.println(_is);
			MessageDialog.show("内容", "标题", DialogButtonType.OK, DialogIconType.Warning);
		}
	}
}
